/*!
\copyright  Copyright (c) 2021-2024 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\defgroup   data_blob
\ingroup    vm_libs
\brief      Type that defines an abstract block of data
*/

#ifndef DATA_BLOB_TYPES_H_
#define DATA_BLOB_TYPES_H_

/*! @{ */

typedef struct
{
    size_t data_length;
    void *data;
} data_blob_t;

typedef struct
{
    size_t data_length;
    const void *data;
} const_data_blob_t;

/*! \brief Create a data blob
    \note Free using DataBlob_Free
    \param[in] size The size of the blob to create
    \return The data blob created
*/
data_blob_t DataBlob_Create(size_t size);

/*! \brief Free a data blob, will also set it back to empty (zero)
    \param[in,out] blob The reference of the blob to free
*/
void DataBlob_Free(data_blob_t *blob);

/*! \brief Concatenate two blobs of data into a new one
    \note The input blobs will be freed
    \param[in,out] blob_1 The reference of the first blob (its contents will be first in the new blob), freed upon return
    \param[in,out] blob_1 The reference of the second blob (its contents will be second in the new blob), freed upon return
    \return The data blob created
*/
data_blob_t DataBlob_Concatenate(data_blob_t *blob_1, data_blob_t *blob_2);

/*! \brief Get the const equivalent of the input blob
    \param[in] blob Input blob
    \return The const equivalent
*/
const_data_blob_t DataBlob_GetConst(data_blob_t blob);

/*! @} */

#endif /* DATA_BLOB_TYPES_H_ */
